<template>
  <dt-modal-edit ref='tip' title='调整原因' always-tip cancel-tip='是否放弃输入调整原因并且将调整金额清零？' @ok='onOk' @cancel='onCancel' />
</template>

<script>
  import ruleOpt from '@/biz/option/rule.js'
  export default {
    data() {
      return {
        info: {
          reason: null
        },
        change: null
      }
    },
    mounted() {
    },
    methods: {
      show(change) {
        this.change = change
        this.$refs.tip.show([{
          key: 'reason',
          placeholder: '请输入调整原因',
          input: {},
          rules: [
            ruleOpt.required('请输入调整原因')
          ]
        }], this.info)
      },
      hide() {
        this.$refs.tip.hide()
      },
      onOk() {
        this.change(this.info.reason)
        this.hide()
      },
      onCancel() {
        this.change(null)
        this.hide()
      }
    }
  }
</script>

<style>
</style>
